<template>
    <el-dialog  v-model="props.visible" :title="props.title" :width="props.width + 'px'" :before-close="onClose"
        append-to-body class="sys-dialog">

        <div :style="{ height: props.height + 'px' }">
            <slot name="content"></slot>
        </div>
        <template #footer>
            <span class="dialog-footer">
                <el-button type="danger" @click="onClose">取消</el-button>
                <el-button type="primary" @click="onConfirm">确定</el-button>
            </span>
        </template>
    </el-dialog>
</template>

<script setup lang="ts">

interface DialogProps {
    title?: string,
    visible: boolean,
    width?: number,
    height?: number,
}



// 属性
const props = withDefaults(defineProps<DialogProps>(), {
    title: '标题',
    visible: false,
    width: 630,
    height: 280,
})




// 注册事件
const emit = defineEmits(["onClose", "onConfirm"])

// 关闭弹框方法
const onClose = () => {
    emit("onClose")
}
// 确定
const onConfirm = () => {
    emit("onConfirm")
}


</script>

<style  lang="scss">
.el-dialog {
    border-top-left-radius: 7px !important;
    border-top-right-radius: 7px !important;

    .el-dialog__header {
        margin-right: 0;
        border-top-left-radius: 7px !important;
        border-top-right-radius: 7px !important;
        background-color: #009688 !important;

        .el-dialog__title {
            color: #FFF;
            font-size: 16px;
            font-weight: 600;
        }
    }

    .el-dialog__headerbtn {
        .el-dialog__close {
            color: #FFF;
        }
    }



    .el-dialog__body {
        padding: 10px;
    }

    .el-dialog__footer {
        border-top: 1px solid #e8eaec !important;
        padding: 10px;
    }



}
</style>